package cn.hackcloud.annotation.test;

import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import cn.hackcloud.annotation.config.MainConfigOfLifeCycle;

public class IOCTestLifeCycle {
	AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MainConfigOfLifeCycle.class);

	@Test
	public void test() {
		System.out.println("容器创建完成...");
		//ctx.getBean("car");
		ctx.close();
		// printBeans(ctx);

	}

	public void printBeans(AnnotationConfigApplicationContext context) {
		String[] beans = context.getBeanDefinitionNames();
		for (String bean : beans) {
			System.out.println(bean);
		}
	}

}
